package com.qf.day05;

public class Cat {
    String name;
    int age;
    String color;
    double weight;
    String sex;
    String various;
    int heart=0;

    public Cat() {
    }

    public Cat(String name) {
        this.name = name;
    }

    public Cat(String name, int age, String color, double weight, String sex, String various, int heart) {
        this.name = name;
        this.age = age;
        this.color = color;
        this.weight = weight;
        this.sex = sex;
        this.various = various;
        this.heart = heart;
    }

    public void eat(){
        this.heart+=10;
        System.out.println(this.name+"在吃东西,心情值:"+this.heart);
    }
    public void sleep(){
        this.heart+=5;
        System.out.println(this.name+"在睡觉,心情值:"+this.heart);

    }
    public void catchFish(){
        this.heart+=15;
        System.out.println(this.name+"在捕鱼,心情值:"+this.heart);
    }
    public void jump(){
        this.heart-=5;
        this.weight-=0.1;
        System.out.println(this.name+"在后空翻,心情值:"+this.heart+"体重:"+this.weight);
    }
    public void burbleSort(){
        int [] arr={2,1,5,3,4};
        for (int i = 0; i < arr.length-1; i++) {
            for (int j = 0; j < arr.length-i-1; j++) {
                if(arr[j+1]>arr[j]){
                    int temp=arr[j];
                    arr[j]=arr[j+1];
                    arr[j+1]=temp;
                }
            }
        }
        System.out.print(this.name+"排序完了为:");
        System.out.print("[ ");
        for (int i = 0; i < arr.length; i++) {
            System.out.print(arr[i]+" ");
        }
        System.out.println("]");
        this.heart-=15;
        System.out.println(this.name+"在冒泡法排序,心情值:"+this.heart);
    }


}
